package com.honvay.cola.cloud.construction.controller;


import com.honvay.cola.cloud.construction.entity.PublicMsg;
import com.honvay.cola.cloud.construction.service.PublicMsgService;
import com.honvay.cola.cloud.framework.base.controller.BaseController;
import com.honvay.cola.cloud.framework.core.protocol.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 * 发布信息-找人、找活表 控制器
 * </p>
 *
 * @author stonihiy
 * @since 2018-10-11
 */
@RestController
@RequestMapping("/construction/publicMsg")
@Api(tags = "发布信息-找人、找活表 接口")
public class PublicMsgController extends BaseController {

        @Autowired
        private PublicMsgService publicMsgService;

        /**
         * 获取发布信息-找人、找活表列表
         */
        @GetMapping(value = "/list")
        @ApiOperation("获取发布信息-找人、找活表列表")
        public Result<List<PublicMsg>> list() {
            return this.success(publicMsgService.selectList());
        }

        /**
         * 新增发布信息-找人、找活表
         */
        @PostMapping(value = "/add")
        @ApiOperation("新增发布信息-找人、找活表")
        public Result<String> add(PublicMsg publicMsg) {
            publicMsgService.insert(publicMsg);
            return this.success();
        }

        /**
         * 删除发布信息-找人、找活表
         */
        @PostMapping(value = "/delete/{id}")
        @ApiOperation("删除发布信息-找人、找活表")
        public Result<String> delete(@PathVariable("id") Long id) {
            publicMsgService.deleteById(id);
            return this.success();
        }

        /**
         * 修改发布信息-找人、找活表
         */
        @PostMapping(value = "/update")
        @ApiOperation("修改发布信息-找人、找活表")
        public Result<String> update(PublicMsg publicMsg) {
            publicMsgService.updateById(publicMsg);
            return this.success();
        }

        /**
         * 获取发布信息-找人、找活表
         */
        @GetMapping(value = "/get/{id}")
        @ApiOperation("获取发布信息-找人、找活表")
        public Result<PublicMsg> get(@PathVariable("id") Long id) {
            return this.success(publicMsgService.selectById(id));
        }
}

